import { Column, PrimaryGeneratedColumn } from "typeorm";
import { EntityModel } from "@midwayjs/orm";

@EntityModel("users", { schema: "simfeng" })
export class Users {
  @PrimaryGeneratedColumn({ type: "int", name: "id", comment: "用户ID" })
  id: number;

  @Column("varchar", {
    name: "name",
    nullable: true,
    comment: "用户姓名",
    length: 255,
  })
  name: string | null;

  @Column("varchar", {
    name: "email",
    nullable: true,
    comment: "用户邮箱",
    length: 255,
  })
  email: string | null;

  @Column("varchar", {
    name: "phone",
    nullable: true,
    comment: "用户手机号码",
    length: 255,
  })
  phone: string | null;

  @Column("varchar", {
    name: "role",
    nullable: true,
    comment: "角色",
    length: 255,
  })
  role: string | null;

  @Column("int", { name: "company_id", nullable: true, comment: "所属公司ID" })
  companyId: number | null;

  @Column("int", {
    name: "parent_id",
    nullable: true,
    comment: "上级代理ID",
    default: () => "'0'",
  })
  parentId: number | null;

  @Column("datetime", { name: "created_at", nullable: true })
  createdAt: Date | null;

  @Column("datetime", { name: "updated_at", nullable: true })
  updatedAt: Date | null;
}
